from datetime import datetime

# 日期格式话模版
format_pattern = "%H:%M:%S"
 
end_date = datetime.now()
end_date = end_date.strftime(format_pattern)
end_date = datetime.strptime(end_date, format_pattern)
# 将 'datetime.datetime' 类型时间通过格式化模式转换为 'str' 时间
if   end_date > datetime.strptime('11:00:00', format_pattern) and end_date < datetime.strptime('13:00:00', format_pattern) :
    print('ok')
elif end_date > datetime.strptime('17:00:00', format_pattern) and end_date < datetime.strptime('18:00:00', format_pattern) :
    print('ok2')

